home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Amiga Collections: Franz PD
/
Franz PD Disk #067 (1990-04)(Amiga User Group Deutschland e.V.).zip
/
Franz PD Disk #067 (1990-04)(Amiga User Group Deutschland e.V.).adf
/
Examples
/
ConsoleTest.p
< prev
next >
Wrap
Text File
|
1989-07-02
|
1KB
|
68 lines
Program ConsoleTest;
{
This program demonstrates and tests the console IO routines.
It uses the a small group of routines I wrote to make it a bit easier
to port Turbo programs that do screen IO.
}
{$I ":Include/Ports.i"}
{$I ":Include/Intuition.i" for window structures and functions }
{$I ":Include/CRT.i" for ReadKey, WriteString, AttachConsole, etc. }
var
w : WindowPtr;
Function OpenTheWindow() : Boolean;
var
nw : NewWindowPtr;
begin
new(nw);
with nw^ do begin
LeftEdge := 20;
TopEdge := 50;
Width := 300;
Height := 100;
DetailPen := -1;
BlockPen := -1;
IDCMPFlags := 0;
Flags := WINDOWSIZING_f + WINDOWDRAG_f + WINDOWDEPTH_f +
SMART_REFRESH_f + ACTIVATE_f;
FirstGadget := nil;
CheckMark := nil;
Title := "Press q to Quit";
Screen := Nil;
BitMap := nil;
MinWidth := 50;
MaxWidth := -1;
MinHeight := 20;
MaxHeight := -1;
WType := WBENCHSCREEN_f;
end;
w := OpenWindow(nw);
dispose(nw);
OpenTheWindow := w <> nil;
end;
var
ConBlock : Address;
ch : Array [0..1] of Char;
begin
if OpenTheWindow() then begin
ConBlock := AttachConsole(w);
if ConBlock <> Nil then begin
ch[1] := '\0'; { Just for ease of writing }
repeat
ch[0] := ReadKey(ConBlock);
WriteString(ConBlock, Adr(ch));
until ch[0] = 'q';
DetachConsole(ConBlock);
end else
Writeln('Could not open console device');
CloseWindow(w);
end else
writeln('Could not open the window');
end.